<template>
    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span>注册</span>
        </div>
        <el-form :model="user" label-width="60px">
            <el-form-item label="用户名">
                <el-input v-model="user.username"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input v-model="user.password"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button
                    type="primary"
                    @click="onSubmit"
                    style="margin-left: 50px"
                    >注册</el-button
                >
                <el-button>取消</el-button>
            </el-form-item>
            <router-link to="/login" style="margin-left:120px">已有账号，去登录</router-link>
        </el-form>
    </el-card>
</template>

<script>
export default {
    data() {
        return {
            user: {
                username: "",
                password: "",
            },
        };
    },
    methods: {
          async onSubmit() {
            // const res = await this.api.users.register(this.user);
            // if (res.code) {
            //     this.$message({
            //         message: "恭喜你注册成功",
            //         type: "success",
            //     });
            // }else{
            //      this.$message.error('注册失败,已有此账户存在');
            // }
        },
        
    },
};
</script>
<style scoped>
.el-card {
    width: 400px;
    margin: 100px auto;
}
</style>